%% xyframe.tex from $Id: xyframe.doc,v 2.12 1994/10/25 11:34:25 kris Exp $
%%
%% XY-pic ``Frames and Brackets'' extension.
%% Copyright (c) 1991-1994 Kristoffer H. Rose <kris@diku.dk>
%%
%% This file is part of the XY-pic package for graphs and diagrams in TeX.
%% See the companion README and INSTALL files for further information.
%% Copyright (c) 1991-1994 Kristoffer H. Rose <kris@diku.dk>
%%
%% The XY-pic package is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by the
%% Free Software Foundation; either version 2 of the License, or (at your
%% option) any later version.
%%
%% The XY-pic package is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
%% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
%% for more details.
%%
%% You should have received a copy of the GNU General Public License along
%% with this package; if not, write to the Free Software Foundation, Inc.,
%% 675 Mass Ave, Cambridge, MA 02139, USA.
%%
\ifx\xyloaded\undefined \input xy \fi
\xyprovide{frame}{Frame and Bracket extension}{\stripRCS$Revision: 2.12 $}%
 {Kristoffer H.~Rose}{kris@diku.dk}%
 {Computer Science, University of Copenhagen, Universitetsparken~1,
 DK--2100 K{\o}benhavn~{\O}}
\xydef@\frm#1#{\hbox{}\dimen@=\Lc \advance\dimen@\Rc \wdz@=\dimen@
 \ht\z@=\Uc \dp\z@=\Dc \dimen@=\Uc \advance\dimen@\Dc
 \ifdim\wdz@=\z@ \def\Leftness@{0}\else \quotient@\Leftness@\Lc\wdz@ \fi
 \ifdim\dimen@=\z@ \def\Upness@{0}\else \quotient@\Upness@\Uc\dimen@ \fi
 \frm@{#1}}
\xydef@\frm@#1#2{\DN@{*frm@#2@}%
 \expandafter\let\expandafter\next\csname\codeof\next@\endcsname
 \ifx\next\relax \DN@{\frm{#2}}%
 \xyerror@{illegal <frame>: \codeof\next@\space not defined}{}\def\Drop@@{}%
 \else
 \DNii@##1{\def\Drop@@{##1#1}%
 \def\Connect@@{\xy@@{\save@\cmerge@\Yp\Xp\Dp\Up\Lp\Rp}##1#1\restore}}%
 \expandafter\nextii@\csname\codeof\next@\endcsname
 \fi}
\xydefcsname@{*frm@@}{\ignorespaces}
\xydefcsname@{*frm@.@}{\dotframed}
\xydefcsname@{*frm@..@}{\dotframed}
\xydefcsname@{*frm@-@}{\framed}
\xydefcsname@{*frm@=@}{\Framed}
\xydefcsname@{*frm@--@}{\dashframed}
\xydefcsname@{*frm@o-@}{\rounddashframed}
\xydef@\dotframed{\xy@@{%
 \def\framehfill{%
 \setboxz@h{\kern5\B@\zerodot\kern5\B@}\ht\z@=\B@ \dp\z@=\B@
 \kern5\B@\xleaders\boxz@\hss\kern5\B@}%
 \def\framevfill{%
 \setboxz@h to2\B@{\hss\zerodot\hss}\ht\z@=5\B@ \dp\z@=5\B@
 \kern5\B@\xleaders\boxz@\vss\kern5\B@}%
 \let\zerocorner=\zerodot
 \framed@@\z@}}
\xydef@\framed{\DN@{%
 \addLT@\ifx \next
 \addGT@{\addLT@\DN@####1}{\xy@@{\framed@{####1}}}%
 \else \DN@{\xy@@{\framed@\z@}}%
 \fi\next@}\xyFN@\next@}
\xydef@\Framed{\DN@{%
 \addLT@\ifx \next
 \addGT@{\addLT@\DN@####1}{\xy@@{\dimen@=####1\framed@\dimen@
 {\advance\Lc-2\p@ \advance\Rc-2\p@ \advance\Uc-2\p@ \advance\Dc-2\p@
 \advance\dimen@-2\p@ \framed@\dimen@}}}%
 \else \DN@{\xy@@{\R@=\z@ \framed@\z@
 {\advance\Lc-2\p@ \advance\Rc-2\p@ \advance\Uc-2\p@ \advance\Dc-2\p@
 \framed@\z@}}}%
 \fi\next@}\xyFN@\next@}
\xydef@\framed@{%
 \def\framehfill{\leaders\hrule height\B@ depth\B@\hfill}%
 \def\framevfill{\leaders\vrule width2\B@\vfill}%
 \let\zerocorner=\zerodot
 \framed@@}
\xydef@\framed@@#1{\setboxz@h{\R@=#1\relax
 \dimen@i=\Lc \advance\dimen@i\Rc \dimen@ii=\Uc \advance\dimen@ii\Dc
 \ifdim.5\dimen@i<\R@ \R@=.5\dimen@i \fi
 \ifdim.5\dimen@ii<\R@ \R@=.5\dimen@ii \fi
 \A@=\Xc \advance\A@-\Lc \B@=\Yc \advance\B@-\Dc
 \ifdim\R@<\p@\else \cirrestrict@@ \fi
 \dimen@=2\R@ \advance\dimen@-\Lc \advance\dimen@-\Rc
 \ifdim\dimen@>\z@ \advance\A@-.5\dimen@ \fi
 \dimen@=2\R@ \advance\dimen@-\Uc \advance\dimen@-\Dc
 \ifdim\dimen@>\z@ \advance\B@-.5\dimen@ \fi
 \kern\A@ \raise\B@\vbox to \dimen@ii{%
 \advance\dimen@ii.22\p@ \advance\dimen@-.2\p@
 \setboxz@h{\corn@@4\R@}\A@=-.5\wdz@ \B@=.5\xydashw@
 \setboxz@h to\dimen@i{\kern\A@ \boxz@ \framehfill\corn@@3\R@\kern\A@}%
 \advance\dimen@ii-\dp\z@ \kern-\ht\z@ \nointerlineskip\boxz@
 \setboxz@h to\dimen@i{\kern\A@\corn@@1\R@\framehfill\corn@@2\R@\kern\A@}%
 \advance\dimen@ii-\ht\z@
 \nointerlineskip\hbox to\dimen@i{%
 \setbox\z@=\vbox to\dimen@ii{\framevfill}\kern-.5\wdz@\copy\z@
 \hss \copy\z@\kern-.5\wdz@}%
 \nointerlineskip\boxz@ \vss \kern\z@}}%
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@ }
\xylet@\zerocorner=\zerodot
\xydef@\corn@@#1#2{\hbox\bgroup \R@=#2\relax
 \ifdim\R@<\p@ \zerocorner
 \else \cirrestrict@@ \multiply\count@8
 \ifcase#1\or \setboxz@h{\circhar@@\z@ \circhar@@\@ne}\dimen@=\wdz@ \ht\z@=\z@
 \kern\dimen@ \raise\dimen@\boxz@
 \or \setboxz@h{\circhar@@\tw@ \circhar@@3}\dimen@=\wdz@ \ht\z@=\z@
 \raise\dimen@\boxz@ \kern\dimen@
 \or \setboxz@h{\circhar@@5\circhar@@4}\dimen@=\wdz@ \dp\z@=\z@
 \lower\dimen@\boxz@ \kern\dimen@
 \or \setboxz@h{\circhar@@7\circhar@@6}\dimen@=\wdz@ \dp\z@=\z@
 \kern\dimen@ \lower\dimen@\boxz@ \fi
 \vrule height\dimen@ depth\dimen@ width\z@\fi
 \edef\tmp@{\egroup \Uc=\the\dimen@}\tmp@ \Dc=\Uc \Lc=\Uc \Rc=\Uc
 \Edgec={\circleEdge}\ignorespaces}
\xydef@\dashhfillchar{{\rDirection@\xydashl@ \line@@}}
\xydef@\dashvfillchar{{\dDirection@\xydashl@ \line@@}}
\xydef@\dashframed{\xy@@{%
 \def\framehfill{%
 \setboxz@h{\dashhfillchar}%
 \ht\z@=\B@ \dp\z@=\B@ \wdz@=2\xydashl@
 \copy\z@ \xleaders\copy\z@\hss \boxz@\kern-\xydashl@}%
 \def\framevfill{%
 \setboxz@h to2\B@{\hss\dashvfillchar\hss}\ht\z@=\z@ \dp\z@=2\xydashl@
 \nointerlineskip\copy\z@ \xleaders\copy\z@\vss
 \nointerlineskip\boxz@\kern-\xydashl@}%
 \let\zerocorner=\zerodot \framed@@\z@}}
\xydef@\rounddashframed{\xy@@{%
 \def\framehfill{\setboxz@h{\kern\xydashl@\dashhfillchar}%
 \ht\z@=\B@ \dp\z@=\B@
 \copy\z@ \xleaders\copy\z@\hss \boxz@ \kern\xydashl@}%
 \def\framevfill{\ifdim\dimen@ii<2\xydashl@\else%
 \setbox\z@=\vbox to2\xydashl@{\hbox to2\B@{\hss\dashvfillchar\hss}\vss}%
 \kern\xydashl@ \copy\z@ \xleaders\copy\z@\vss
 {\ifdim\dimen@ii<2\xydashl@\else\aftergroup\boxz@\fi}\fi}%
 \let\zerocorner=\zerodot \framed@@{.8\xydashl@}}}
\xydefcsname@{*frm@,@}{\shaded}
\xydefcsname@{*frm@-,@}{\framed\shaded}
\xydef@\shaded{\DN@{%
 \addLT@\ifx \next
 \addGT@{\addLT@\DN@####1}{\xy@@{\shaded@{####1}}}%
 \else \DN@{\xy@@{\shaded@{1.2\p@}}}%
 \fi\next@}\xyFN@\next@}
\xydef@\shaded@#1{\xy@@{\R@=#1\relax
 {\advance\Xc\R@ \advance\Yc-\Dc \Uc=\z@ \Dc=\R@ \blacked@}%
 {\advance\Xc\Rc \advance\Yc-\R@ \Lc=\z@ \Rc=\R@ \blacked@}}}
\xydefcsname@{*frm@*@}{\blacked}
\xydef@\blacked{\xy@@\blacked@}
\xydef@\blacked@{\setboxz@h{%
 \A@=\Xc \advance\A@-\Lc \dimen@=\Lc \advance\dimen@\Rc
 \B@=\Yc \advance\B@-\Dc \dimen@ii=\Yc \advance\dimen@ii\Uc
 \advance\A@-.5\xydashw@ \advance\B@-\xydashw@ \advance\dimen@ii-.5\xydashw@
 \kern\A@ \vrule width\dimen@ depth-\B@ height\dimen@ii}%
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@}
\xydefcsname@{*frm@o@}{\circled}
\xydefcsname@{*frm@oo@}{\Circled}
\xydef@\circled{\DN@{%
 \addLT@\ifx \next
 \addGT@{\addLT@\DN@####1}{\xy@@{\circled@{####1}}}%
 \else
 \DN@{\xy@@{\dimen@=.5\Lc \advance\dimen@.5\Rc \circled@\dimen@}}%
 \fi\next@}\xyFN@\next@}
\xydef@\Circled{\DN@{%
 \addLT@\ifx \next
 \addGT@{\addLT@\DN@####1}{\xy@@{\dimen@=####1 \circled@\dimen@
 \advance\dimen@-2.1\p@ \circled@\dimen@}}%
 \else
 \DN@{\xy@@{\dimen@=.5\Lc \advance\dimen@.5\Rc \circled@\dimen@
 \advance\dimen@-2.1\p@ \circled@\dimen@}}%
 \fi\next@}\xyFN@\next@}
\xydef@\circled@#1{\setboxz@h\bgroup \R@=#1\relax
 \setboxz@h{\vbox{\hbox{\corn@@4\R@ \corn@@3\R@}%
 \nointerlineskip\hbox{\corn@@1\R@ \corn@@2\R@}}}%
 \A@=\Xc \advance\A@-.5\wd\z@
 \B@=\Yc \advance\B@-.5\ht\z@ \advance\B@.5\dp\z@ \advance\B@.2\p@
 \edef\tmp@{\egroup\dimen@=\the\wdz@}%
 \kern\A@ \raise\B@\boxz@
 \tmp@ \divide\dimen@4 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@}
\xydefcsname@{*frm@\{@}{\lbraced}
\xydefcsname@{*frm@\}@}{\rbraced}
\xydefcsname@{*frm@^\}@}{\ubraced}
\xydefcsname@{*frm@_\}@}{\dbraced}
\xydef@\dbraced{\xy@@{\setboxz@h{%
 \A@=\Xc \advance\A@-\Lc \B@=\Yc \advance\B@-\Dc
 \setboxz@h{$\m@th\bracelu$}\dimen@=2\wdz@ \advance\B@-.5\ht\z@
 \ifdim\Rc<\dimen@ \Rc=\dimen@ \fi
 \ifdim\Lc<\dimen@ \advance\A@-\dimen@ \advance\A@\Lc \Lc=\dimen@ \fi
 \advance\A@-.25pt
 \kern\A@\raise\B@\hbox{%
 \hbox to\Lc{$\m@th\bracelu\leaders\vrule\hfil\bracerd$}%
 \kern.5pt
 \hbox to\Rc{$\m@th\braceld\leaders\vrule\hfil\braceru$}}}%
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@}}
\xydef@\ubraced{\xy@@{\setboxz@h{%
 \A@=\Xc \advance\A@-\Lc \B@=\Yc \advance\B@\Uc
 \setboxz@h{$\m@th\bracelu$}\dimen@=2\wdz@
 \ifdim\Rc<\dimen@ \Rc=\dimen@ \fi
 \ifdim\Lc<\dimen@ \advance\A@-\dimen@ \advance\A@\Lc \Lc=\dimen@ \fi
 \advance\A@-.25pt
 \kern\A@\raise\B@\hbox{%
 \hbox to\Lc{$\m@th\braceld\leaders\vrule\hfil\braceru$}%
 \kern.5pt
 \hbox to\Rc{$\m@th\bracelu\leaders\vrule\hfil\bracerd$}}}%
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@}}
{\catcode`\"=12
 \global\mathchardef\braceur="338
 \global\mathchardef\braceul="339
 \global\mathchardef\bracedr="33A
 \global\mathchardef\bracedl="33B
 \global\mathchardef\bracecl="33C
 \global\mathchardef\bracecr="33D
 \global\mathchardef\bracec="33E }
\xydef@\lbraced{\xy@@{\setboxz@h{%
 \A@=\Xc \advance\A@-\Lc \B@=\Yc \advance\B@-\Dc
 \setboxz@h{$\m@th\bracecl$}\dimen@ii=\dp\z@ \advance\A@-.5\wdz@
 \setboxz@h{$\m@th\bracec$}\dimen@=\dp\z@
 \ifdim\Uc<.5\dimen@ \Uc=.5\dimen@ \fi
 \ifdim\Dc<.5\dimen@ \advance\B@-.5\dimen@ \advance\B@\Dc \Dc=.5\dimen@ \fi
 \advance\Uc.6\p@ \advance\Dc.6\p@ \advance\B@-.6\p@
 \kern\A@\raise\B@\vbox{\vbox to\Uc{%
 \nointerlineskip\hbox{$\m@th\braceur$}%
 \kern-.61\dimen@ \cleaders\copy\z@\vfil \kern-.4\dimen@
 \nointerlineskip\hbox{$\m@th\bracecl$}\kern-.5\dimen@ii}%
 \nointerlineskip\vbox to\Dc{\kern.5\dimen@ii
 \kern-.4\dimen@ \cleaders\copy\z@\vfil \kern-.61\dimen@
 \nointerlineskip\hbox{$\m@th\bracedr$}\kern\z@}}}%
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@}}
\xydef@\rbraced{\xy@@{\setboxz@h{%
 \A@=\Xc \advance\A@\Rc \B@=\Yc \advance\B@-\Dc
 \setboxz@h{$\m@th\bracecr$}\dimen@ii=\dp\z@ \advance\A@-.5\wdz@
 \setboxz@h{$\m@th\bracec$}\dimen@=\dp\z@
 \ifdim\Uc<.5\dimen@ \Uc=.5\dimen@ \fi
 \ifdim\Dc<.5\dimen@ \advance\B@-.5\dimen@ \advance\B@\Dc \Dc=.5\dimen@ \fi
 \advance\Uc.6\p@ \advance\Dc.6\p@ \advance\B@-.6\p@
 \kern\A@\raise\B@\vbox{\vbox to\Uc{%
 \nointerlineskip\hbox{$\m@th\braceul$}%
 \kern-.61\dimen@ \cleaders\copy\z@\vfil \kern-.4\dimen@
 \nointerlineskip\hbox{$\m@th\bracecr$}\kern-.5\dimen@ii}%
 \nointerlineskip\vbox to\Dc{\kern.5\dimen@ii
 \kern-.4\dimen@ \cleaders\copy\z@\vfil \kern-.61\dimen@
 \nointerlineskip\hbox{$\m@th\bracedl$}\kern\z@}}}%
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@}}
\xydefcsname@{*frm@(@}{\lparenthesized}
\xydefcsname@{*frm@)@}{\rparenthesized}
\xydefcsname@{*frm@^)@}{\uparenthesized}
\xydefcsname@{*frm@_)@}{\dparenthesized}
\xydef@\dparenthesized{\xy@@{\setboxz@h{%
 \A@=\Xc \advance\A@-\Lc \B@=\Yc \advance\B@-\Dc
 \setboxz@h{$\m@th\bracelu$}\dimen@=2\wdz@ \advance\B@-.5\ht\z@
 \ifdim\Rc<\dimen@ \Rc=\dimen@ \fi
 \ifdim\Lc<\dimen@ \advance\A@-\dimen@ \advance\A@\Lc \Lc=\dimen@ \fi
 \dimen@=\Lc \advance\dimen@\Rc
 \kern\A@\raise\B@\hbox to\dimen@{%
 $\m@th\bracelu\leaders\vrule\hfil\braceru$}}%
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@}}
\xydef@\uparenthesized{\xy@@{\setboxz@h{%
 \A@=\Xc \advance\A@-\Lc \B@=\Yc \advance\B@\Uc
 \setboxz@h{$\m@th\bracelu$}\dimen@=2\wdz@
 \ifdim\Rc<\dimen@ \Rc=\dimen@ \fi
 \ifdim\Lc<\dimen@ \advance\A@-\dimen@ \advance\A@\Lc \Lc=\dimen@ \fi
 \dimen@=\Lc \advance\dimen@\Rc
 \kern\A@\raise\B@\hbox to\dimen@{%
 $\m@th\braceld\leaders\vrule\hfil\bracerd$}}%
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@}}
\xydef@\lparenthesized{\xy@@{\setboxz@h{%
 \A@=\Xc \advance\A@-\Lc \B@=\Yc \advance\B@-\Dc
 \setboxz@h{$\m@th\bracecr$}\dimen@ii=\dp\z@ \advance\A@-.5\wdz@
 \setboxz@h{$\m@th\bracec$}\dimen@=\dp\z@
 \ifdim\Uc<.5\dimen@ \Uc=.5\dimen@ \fi
 \ifdim\Dc<.5\dimen@ \advance\B@-.5\dimen@ \advance\B@\Dc \Dc=.5\dimen@ \fi
 \advance\Uc.6\p@ \advance\Dc.6\p@ \advance\B@-.6\p@
 \dimen@ii\Uc \advance\dimen@ii\Dc
 \kern\A@\raise\B@\vbox to \dimen@ii{%
 \nointerlineskip\hbox{$\m@th\braceur$}%
 \kern-.61\dimen@ \cleaders\copy\z@\vfil \kern-.61\dimen@
 \nointerlineskip\hbox{$\m@th\bracedr$}\kern\z@}}%
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@}}
\xydef@\rparenthesized{\xy@@{\setboxz@h{%
 \A@=\Xc \advance\A@\Rc \B@=\Yc \advance\B@-\Dc
 \setboxz@h{$\m@th\bracecr$}\dimen@ii=\dp\z@ \advance\A@-.5\wdz@
 \setboxz@h{$\m@th\bracec$}\dimen@=\dp\z@
 \ifdim\Uc<.5\dimen@ \Uc=.5\dimen@ \fi
 \ifdim\Dc<.5\dimen@ \advance\B@-.5\dimen@ \advance\B@\Dc \Dc=.5\dimen@ \fi
 \advance\Uc.6\p@ \advance\Dc.6\p@ \advance\B@-.6\p@
 \dimen@ii\Uc \advance\dimen@ii\Dc
 \kern\A@\raise\B@\vbox to \dimen@ii{%
 \nointerlineskip\hbox{$\m@th\braceul$}%
 \kern-.61\dimen@ \cleaders\copy\z@\vfil \kern-.61\dimen@
 \nointerlineskip\hbox{$\m@th\bracedl$}\kern\z@}}%
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@}}
\xyendinput
